import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/index.vue'
// import activities from './modules/ManagementOfActivities'
// import LeadManagement from './modules/LeadManagement'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('@/views/login/index.vue'),
      hidden: true
    },
    {
      path: '/',
      redirect: '/dashboard',
      name: 'layout',
      component: Layout,
      hidden: true,
      children: [
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: {
            title: '工作台'
          }
        },
        {
          path: '/clue',
          name: 'clue',
          component: () => import('@/views/clue/index.vue'),
          meta: {
            title: '线索管理'
          }
        },
        {
          path: '/clue/follow-up/:clueId?',
          name: 'follow-up',
          component: () => import('@/views/clue/components/follow-up.vue'),
          meta: {
            title: '线索跟进'
          },
          hidden: false
        },
        {
          path: '/ContractManagement',
          name: 'ContractManagement',
          component: () => import('@/views/ContractManagement/index.vue'),
          meta: {
            title: '合同管理'
          }
        },
        {
          path: '/statisticalAnalysis',
          name: 'statisticalAnalysis',
          component: () => import('@/views/statisticalAnalysis/index.vue'),
          meta: {
            title: '统计分析'
          }
        },
        {
          path: '/course',
          name: 'course',
          component: () => import('@/views/course/index.vue'),
          meta: {
            title: '课程管理'
          }
        },
        {
          path: '/system',
          name: 'system',
          redirect: '/system/permission',
          meta: {
            title: '系统管理'
          },
          children: [
            {
              path: '/system/permission',
              name: 'permission',
              redirect: '/system/permission/user',
              meta: {
                title: '权限管理'
              },
              children: [
                {
                  path: '/system/permission/user',
                  name: 'user',
                  component: () => import('@/views/system/permission/user/index.vue'),
                  meta: {
                    title: '用户管理'
                  }
                },
                {
                  path: '/system/permission/role',
                  name: 'role',
                  component: () => import('@/views/system/permission/role/index.vue'),
                  meta: {
                    title: '角色管理'
                  }
                },
                // {
                //   path: '/clue/follow-up',
                //   name: 'follow-up',
                //   component: () => import('@/views/clue/components/follow-up.vue'),
                //   hidden: false
                // },
                {
                  path: '/system/permission/post',
                  name: 'post',
                  component: () => import('@/views/system/permission/post/index.vue'),
                  meta: {
                    title: '岗位管理'
                  }
                },
                {
                  path: '/system/permission/menu',
                  name: 'menu',
                  component: () => import('@/views/system/permission/menu/index.vue'),
                  meta: {
                    title: '菜单管理'
                  }
                }
              ]
            }
          ]
        },
        {
          path: '/details',
          name: 'details',
          component: () => import('@/views/ContractManagement/details/index.vue'),
          meta: {
            title: '合同详情'
          }
        },
        {
          path: '/reassignment',
          name: 'reassignment',
          component: () => import('@/views/reassignment/index.vue'),
          meta: {
            title: '转派管理'
          }
        }
      ]
    }
  ]
})

export default router
